home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 09 - 1993 / 09.07 Jul 93 / Bedrock Header Files / Intl Includes / BRAttrib.h next >
Encoding:
Text File  |  1993-04-22  |  11.6 KB  |  425 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //      File:        BRAttrib.h
  4. //      Release Version:    1.0d1
  5. // 
  6. //      Creation Date:        March 1993
  7. // 
  8. //      COPYRIGHT 1993 SYMANTEC CORPORATION. ALL RIGHTS RESERVED. UNPUBLISHED -- RIGHTS
  9. //      RESERVED UNDER THE COPYRIGHT LAWS OF THE UNITED STATES. USE OF COPYRIGHT NOTICE IS
  10. //      PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION OR DISCLOSURE.
  11. // 
  12. //      THIS SOFTWARE CONTAINS PROPRIETARY AND CONFIDENTIAL INFORMATION OF SYMANTEC
  13. //      CORPORATION. USE, DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR
  14. //      EXPRESS WRITTEN PERMISSION OF SYMANTEC CORPORATION.
  15. // 
  16. //      RESTRICTED RIGHTS LEGEND
  17. //      Use, duplication, or disclosure by the Government is subject to restrictions as Set
  18. //      forth in subparagraph (c)(l)(ii) of the Rights in Technical Data and Computer
  19. //      Software clause at DFARS 252.227-7013. Symantec Corporation, 10201 Torre Avenue,
  20. //      Cupertino, CA 95014.
  21. // 
  22. //=======================================================================================
  23.  
  24. #ifndef    BRATTRIB_H
  25. #define    BRATTRIB_H
  26. #endif
  27.  
  28. #ifndef    BRWRISYS_H
  29. #include "BRWRISYS.H"
  30. #endif
  31.  
  32.  
  33. //========================================================================================
  34. //    CLASS BR_CCharacterAttributes
  35. //========================================================================================
  36.  
  37. class BR_CCharacterAttributes
  38. {
  39. public:
  40.     BR_CCharacterAttributes();
  41.     BR_CCharacterAttributes(BR_Locale);
  42.     ~BR_CCharacterAttributes();
  43.  
  44.  
  45.     BR_CAttributesTable* GetLetterAttributesTable() const;
  46.     BR_CAttributesTable* GetLetterAttributesTable(BR_LocaleID = UNICODE) const;
  47.     BR_CAttributesTable* GetLetterAttributesTable(const BR_CLocale* someLocale) const;
  48.  
  49.     BR_CAttributesTable* GetNumberAttributesTable() const;
  50.     BR_CAttributesTable* GetNumberAttributesTable(BR_LocaleID = UNICODE) const;
  51.     BR_CAttributesTable* GetNumberAttributesTable(const BR_CLocale* someLocale) const;
  52.  
  53.     BR_CAttributesTable* GetBreakingAttributesTable() const;
  54.     BR_CAttributesTable* GetBreakingAttributesTable(BR_LocaleID = UNICODE) const;
  55.     BR_CAttributesTable* GetBreakingAttributesTable(const BR_CLocale* someLocale) const;
  56.  
  57.     BR_CAttributesTable* GetDirectionalAttributesTable() const;
  58.     BR_CAttributesTable* GetDirectionalAttributesTable(BR_LocaleID = UNICODE) const;
  59.     BR_CAttributesTable* GetDirectionalAttributesTable(const BR_CLocale* someLocale) const;
  60.  
  61.     BR_CAttributesTable* GetShapingAttributesTable() const;
  62.     BR_CAttributesTable* GetShapingAttributesTable(BR_LocaleID = UNICODE) const;
  63.     BR_CAttributesTable* GetShapingAttributesTable(const BR_CLocale* someLocale) const;
  64.  
  65.     BR_CAttributesTable* GetTypeSettingAttributesTable() const;
  66.     BR_CAttributesTable* GetTypeSettingAttributesTable(BR_LocaleID = UNICODE) const;
  67.     BR_CAttributesTable* GetTypeSettingAttributesTable(const BR_CLocale* someLocale) const;
  68.  
  69.     BR_CAttributesTable* GetMiscellaneousAttributesTable() const;
  70.     BR_CAttributesTable* GetMiscellaneousAttributesTable(BR_LocaleID = UNICODE) const;
  71.     BR_CAttributesTable* GetMiscellaneousAttributesTable(const BR_CLocale* someLocale) const;
  72.  
  73.     BR_CAttributesTable* GetScriptAttributesTable() const;
  74.     BR_CAttributesTable* GetScriptAttributesTable(BR_LocaleID = UNICODE) const;
  75.     BR_CAttributesTable* GetScriptAttributesTable(const BR_CLocale* someLocale) const;
  76.  
  77. private:
  78.     //    every one of the foolowing fields is a 16 bit: bit vector.
  79.     //    if bit 0 has the value 0 then the character in question is not of that category
  80.     //    all together. 
  81.     //    Else check the specific bit for the attribute you want.
  82.     //    A field map explaining the bits can be found at the end of the class definition.
  83.  
  84.     BR_CAttributesTable* fLetterAttributesTable;
  85.     BR_CAttributesTable* fNumberAttributesTable;
  86.     BR_CAttributesTable* fBreakingAttributesTable;
  87.     BR_CAttributesTable* fDirectionalAttributesTable;
  88.     BR_CAttributesTable* fShapingAttributesTable;
  89.     BR_CAttributesTable* fTypeSettingAttributesTable;
  90.     BR_CAttributesTable* fMiscellaneousAttributesTable;
  91.     BR_CAttributesTable* fScriptAttributesTable;// 32 bit, bit vector
  92.  
  93.     BR_Locale* fLocale;
  94. };
  95.  
  96.  
  97.  
  98.  
  99.  
  100. //========================================================================================
  101. //    CLASS BR_CAttributesTable    
  102. //========================================================================================
  103.  
  104. class BR_CAttributesTable : public BR_CTable
  105. {
  106. public:
  107.     Boolean DoesCharacterPossessAttribute(Character c,
  108.                                           int attribute) const;
  109.  
  110. protected:
  111.     long GetBitsForCharacter(Character c) = 0;
  112.     Boolean IsBitSet(long,
  113.                      int attribute);
  114.     long fdata[kMaximumWeirdCharactersInAScript];
  115.  
  116. private:
  117.     BR_CLocale* fLocale;
  118. };
  119.  
  120.  
  121. //----------------------------------------------------------------------------------------
  122. //
  123. //    BR_CAttributesTable::DoesCharacterPossessAttribute
  124. //
  125. //----------------------------------------------------------------------------------------
  126.  
  127. inline    Boolean DoesCharacterPossessAttribute(Character c, int attribute)
  128. {
  129.     return IsBitSet(GetBitsForCharacter(c), attribute);
  130. }
  131.  
  132. //========================================================================================
  133. //    CLASS BR_CLettersAttributes
  134. //========================================================================================
  135.  
  136. class  BR_CLettersAttributes : public BR_CAttributesTable
  137. {
  138. public:
  139.     enum    
  140.     {
  141.         kAlphabetic        =    0,
  142.         kDipthong            =    1,    
  143.         kDigraph            =    2,    
  144.         kLigature            =    3,    
  145.         kUpperCase        =    4,    
  146.         kLowerCase        =    5,    
  147.         kCaseIrrelevant    =    6,    
  148.         kIsBase            =    7,    
  149.         kPunctuation        =    8,    
  150.         kSpacing            =    9,    
  151.         kWhiteSpace        =    10,    
  152.         kBreakingSpace    =    11,
  153.         kReserved12                =    12,
  154.         kReserved13                =    13,
  155.         kReserved14                =    14,
  156.         kReserved15                =    15
  157.     };
  158.  
  159.     BR_CLettersAttributes();
  160.     ~BR_CLettersAttributes();
  161.     BR_Boolean    IsAlphabetic(BR_UnicodeCharacter c) // just an example for the mechanism
  162.     {
  163.         return ( DoesCharacterPossessAttribute( c, kAlphabetic)) ; 
  164.     }
  165.     BR_Boolean    SetAlphabetic(BR_Boolean alpha) { alpha ? 1 : 0; }
  166.     
  167.     long         GetBitsForCharacter(Character c);
  168.  
  169. protected :
  170. private:
  171.     long    fBits;
  172.  
  173. };
  174.  
  175. //========================================================================================
  176. //    CLASS BR_CBreakingAttributes
  177. //========================================================================================
  178. class BR_CBreakingAttributes : public BR_CAttributesTable
  179. {
  180. public:
  181.     enum                        
  182.     {                        
  183.         kBreaking                        =    0,    
  184.         kBreakWordBeforeOk            =    1,    
  185.         kBreakWordAfterOk            =    2,    
  186.         kBreakWordIrrelevant            =    3,    
  187.         kBreakLineBeforeOk            =    4,    
  188.         kBreakLineAfterOk            =    5,    
  189.         kBreakLineIrrelevant            =    6,    
  190.         kHyphenCandidate                =    7,    
  191.         kReserved8                            =    8,    
  192.         kReserved9                            =    9,    
  193.         kReserved10                            =    10,    
  194.         kReserved11                            =    11,    
  195.         kReserved12                            =    12,    
  196.         kReserved13                            =    13,    
  197.         kReserved14                            =    14,    
  198.         kReserved15                            =    15,    
  199.     };                        
  200.  
  201.     BR_CBreakingAttributes();
  202.     ~BR_CBreakingAttributes();
  203.     
  204. private:
  205.  
  206. };
  207.  
  208.  
  209.  
  210. //========================================================================================
  211. //    CLASS BR_CNumbersAttributes
  212. //========================================================================================
  213. class  BR_CNumbersAttributes : public BR_CAttributesTable
  214. {
  215. public:    
  216.     enum                        
  217.     {                        
  218.         kNumeric                        =    0,        
  219.         kNumericMissellaneous         =    1,    
  220.         kLatinNumeral                    =    2,    
  221.         kArabicNumeral                =    3,    
  222.         kRomanNumeral                    =    4,        
  223.         kIndicNumeral                    =    5,        
  224.         kLatinNumeralSparator        =    6,            
  225.         kArabicNumeralSparator        =    7,    
  226.         kRomanNumeralSparator        =    8,        
  227.         kIndicNumeralSparator        =    9,    
  228.         kLatinNumeralTerminator        =    10,        
  229.         kArabicNumeralTerminator        =    11,            
  230.         kRomanNumeralTerminator        =    12,
  231.         kIndicNumeralTerminator        =    13,
  232.         kCurrency                        =    14,    
  233.         kReserved15                            =    15,    
  234.     };
  235.     
  236.     BR_CNumbersAttributes();
  237.     ~BR_CNumbersAttributes();
  238. private:
  239. };
  240.  
  241. //========================================================================================
  242. //    CLASS BR_CDirectionalAttributes
  243. //========================================================================================
  244.  
  245. class BR_CDirectionalAttributes : public BR_CAttributesTable
  246. {
  247. public:
  248.     enum                        
  249.     {
  250.         kDirectional            =    0,    
  251.         kRTL                    =    1,    
  252.         kLTR                    =    2,    
  253.         kNeutralDirection        =    3,    
  254.         kLinear                =    4,    
  255.         kReserved5                =    5,    
  256.         kReserved6                =    6,    
  257.         kReserved7                =    7,    
  258.         kReserved8                =    8,    
  259.         kReserved9                =    9,    
  260.         kReserved10                =    10,    
  261.         kReserved11                =    11,    
  262.         kReserved12                =    12,    
  263.         kReserved13                =    13,    
  264.         kReserved14                =    14,    
  265.         kReserved15                =    15,    
  266.     };                        
  267.     
  268.     BR_CDirectionalAttributes();
  269.     ~BR_CDirectionalAttributes();
  270.  
  271. private:
  272.  
  273. };
  274.  
  275. //========================================================================================
  276. //    CLASS BR_CShapingAttributes
  277. //========================================================================================
  278.  
  279. class BR_CShapingAttributes: public BR_CAttributesTable
  280. {
  281. public:
  282.     enum                        
  283.     {                        
  284.         kShaping                    =    0,    
  285.         kStandAlone                =    1,    
  286.         kInitial                    =    2,    
  287.         kMedial                    =    3,    
  288.         kEnding                    =    4,    
  289.         kForceLigatureBefore        =    5,    
  290.         kForceLigatureAfter        =    6,    
  291.         kForceStandAlone            =    7,    
  292.         kFullWidth                =    8,    
  293.         kHalfWidth                =    9,    
  294.         kGlyphBound                =    10,    
  295.         kPrecomposed                =    11,    
  296.         kInvisible                    =    12,    
  297.         kReserved13                        =    13,    
  298.         kReserved14                        =    14,    
  299.         kReserved15                        =    15,    
  300.     };                        
  301.  
  302.     BR_CShapingAttributes();
  303.     ~BR_CShapingAttributes();
  304.     
  305. private:
  306.  
  307. };
  308.  
  309. //========================================================================================
  310. //    CLASS BR_CType_SettingAttributes
  311. //========================================================================================
  312. class BR_CType_SettingAttributes : public BR_CAttributesTable
  313. {
  314. public:
  315.     enum                        
  316.     {                        
  317.         kTypeSetting            =    0,    
  318.         kCanSwash                =    1,    
  319.         kCanSerif                =    2,    
  320.         kHumanlyRenderable    =    3,    
  321.         kReserved4                    =    4,    
  322.         kReserved5                    =    5,    
  323.         kReserved6                    =    6,    
  324.         kReserved7                    =    7,    
  325.         kReserved8                    =    8,    
  326.         kReserved9                    =    9,    
  327.         kReserved10                    =    10,    
  328.         kReserved11                    =    11,    
  329.         kReserved12                    =    12,    
  330.         kReserved13                    =    13,    
  331.         kReserved14                    =    14,    
  332.         kReserved15                    =    15,    
  333.     };                        
  334.  
  335.     BR_CType_SettingAttributes();
  336.     ~BR_CType_SettingAttributes();
  337.  
  338. private:
  339.  
  340. };
  341.  
  342. //========================================================================================
  343. //    CLASS BR_CMiscellaneousAttributes
  344. //========================================================================================
  345.  
  346. class BR_CMiscellaneousAttributes : public BR_CAttributesTable
  347. {
  348. public:
  349.     enum                        
  350.     {                        
  351.         kMiscellaneous            =    0,    
  352.         kControl            =    1,    
  353.         kMapsTo437            =    2,    
  354.         kUnicodeSpecial            =    3,    
  355.         kHasMultipleSemantics            =    4,    
  356.         kReserved5                =    5,    
  357.         kReserved6                =    6,    
  358.         kReserved7                =    7,    
  359.         kReserved8                =    8,    
  360.         kReserved9                =    9,    
  361.         kReserved10                =    10,    
  362.         kReserved11                =    11,    
  363.         kReserved12                =    12,    
  364.         kReserved13                =    13,    
  365.         kReserved14                =    14,    
  366.         kReserved15                =    15,    
  367.     };                        
  368.     
  369.     BR_CMiscellaneousAttributes();
  370.     ~BR_CMiscellaneousAttributes();
  371.  
  372. private:
  373.  
  374. };
  375.  
  376. //========================================================================================
  377. //    CLASS BR_CScriptsAttributes
  378. //========================================================================================
  379.  
  380. class  BR_CScriptsAttributes : public BR_CAttributesTable
  381. {
  382. public:
  383.             
  384.     enum 
  385.     {                        
  386.         kLatin                =    0,    
  387.         kHan                =    1,    
  388.         kArabic                =    2,    
  389.         kSlavic                =    3,    
  390.         kGreeck                =    4,    
  391.         kHebrew                =    5,    
  392.         kThai                =    6,    
  393.         kMongolian            =    7,    
  394.         kEtheiopic            =    8,    
  395.         kHeiroglyphic        =    9,    
  396.         kMultilingual        =    10,    
  397.         kMultiScript        =    11,    
  398.         kDeadScript        =    12,    
  399.         kAffectsReading    =    13,    
  400.         kIPA                =    14,    
  401.         kCantillationMark    =    15,    
  402.         kKoranicStopMark    =    16,    
  403.          Diacrictic            =    17,    
  404.         kPunctuation        =    18,    
  405.         kPhoneticHan        =    19,    
  406.         kPhoneticKana        =    20,    
  407.         kHiragana            =    21,    
  408.         kKatakana            =    22,    
  409.         kRuby                =    23,    
  410.         kBopomofo            =    24,    
  411.         kHangulElement        =    25,    
  412.         kIdeographic        =    26,    
  413.         kPictographic        =    27,    
  414.         kPhonetic            =    28,    
  415.         kReserved29                =    29,    
  416.         kReserved30                =    30,    
  417.         kReserved31                =    31
  418.     };
  419.     
  420.     BR_CScriptsAttributes();
  421.     ~BR_CScriptsAttributes();
  422.  
  423. private:
  424.  
  425. };